package top.greatxiaozou.aspect;

import com.auth0.jwt.exceptions.TokenExpiredException;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import top.greatxiaozou.model.Result;
import top.greatxiaozou.utils.ResultsUtils;

import static top.greatxiaozou.utils.TokenUtils.isActive;
import static top.greatxiaozou.utils.TokenUtils.isEffective;

@Component
@Aspect
public class TokenAspect {

//    @Before("execution(* top.greatxiaozou.utils.TokenUtils.isEffective(String)) && args(token)")
//    public ResponseEntity<Result> token(String token){
//        System.out.println("进入了切面");
//        if (!isActive(token)){
//            return ResultsUtils.faild("token过期，请重新登录", HttpStatus.FORBIDDEN);
//        }
//        return null;
//    }
}
